﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

#pragma once

#include "GcmpDwgDxfInterface.h"
#include <map>
#include <unordered_map>


namespace gcmp
{
    class UniIdentity;
    class ILayerSettings;
    class IHatchSettings;
    class ICADTextStyle;
    class ICADDimensionStyle;
    class IPDFExportParams;

    /// \brief 导出设置
    ///
    /// 导出设置包含图层设置、类别与图层设置的对应关系、类别与填充设置的对应关系
    class GCMP_DWG_DXF_INTERFACE_EXPORT IDrawingExportSettings
    {
    public:
        virtual ~IDrawingExportSettings();

    public:
        /// \brief 创建导出设置类对象
        ///
        /// 默认创建出的内容为空，需要调用相应的Set方法设置。
        /// \return 返回导出设置类对象
        static gcmp::OwnerPtr<IDrawingExportSettings> Create();

    public:
#pragma region Layer
        /// \brief 添加层设置
        ///
        /// 会覆盖掉之前设置的内容
        /// \param layerSettings 层设置
        /// \return 成功返回true,否则返回false
        virtual bool SetLayerSettings(const std::vector<gcmp::OwnerPtr<gcmp::ILayerSettings>>& layerSettings) = 0;

        /// \brief 获取层设置
        /// \return 返回层设置
        virtual const std::vector<gcmp::OwnerPtr<gcmp::ILayerSettings>>& GetLayerSettings() const = 0;

        /// \brief 获取层设置
        /// \return 返回层设置
        virtual std::vector<gcmp::OwnerPtr<gcmp::ILayerSettings>>& GetLayerSettings() = 0;

        /// \brief 根据图层名称获取图层
        /// \return 返回图层设置
        virtual const ILayerSettings* GetLayerSettings(const std::wstring& layerName) const = 0;

        /// \brief 添加CAD文字样式
        ///
        /// 会覆盖掉之前设置的内容
        /// \param cadTextStyles 文字样式
        /// \return 成功返回true,否则返回false
        virtual bool SetCADTextStyle(const std::vector<gcmp::OwnerPtr<gcmp::ICADTextStyle>>& cadTextStyles) = 0;

        /// \brief 获取文字样式
        /// \return 返回文字样式
        virtual const std::unordered_map<std::wstring, gcmp::OwnerPtr<gcmp::ICADTextStyle>>& GetCADTextStyle() const = 0;

        /// \brief 添加CAD标注样式
        ///
        /// 会覆盖掉之前设置的内容
        /// \param cadDimensionStyles 标注样式
        /// \return 成功返回true,否则返回false
        virtual bool SetCADDimensionStyle(const std::vector<gcmp::OwnerPtr<gcmp::ICADDimensionStyle>>& cadDimensionStyles) = 0;

        /// \brief 获取标注样式
        /// \return 返回标注样式
        virtual const std::unordered_map<std::wstring, gcmp::OwnerPtr<gcmp::ICADDimensionStyle>>& GetCADDimensionStyle() const = 0;

        /// \brief 添加类别与层设置的对应关系
        ///
        /// 会覆盖掉之前设置的内容
        /// \param categoryAndLayerSettingMap 类别与层设置的对应关系
        /// \return 返回true表示设置成功，否则设置失败
        virtual bool SetCategoryAndLayerSettingMap(const std::map<gcmp::UniIdentity, std::wstring>& categoryAndLayerSettingMap) = 0;

        /// \brief 获得类别与层设置的对应关系
        /// \return 返回类别与层设置的对应关系
        virtual const std::map<gcmp::UniIdentity, std::wstring>& GetCategoryAndLayerSettingMap() const = 0;

        /// \brief 获得类别与层设置的对应关系
        /// \return 返回类别与层设置的对应关系
        virtual std::map<gcmp::UniIdentity, std::wstring>& GetCategoryAndLayerSettingMap() = 0;

#pragma endregion Layer

#pragma region Hatch
        /// \brief 添加类别与填充设置的对应关系
        ///
        /// 会覆盖掉之前设置的内容
        /// \param categoryAndHatchSettingMap 类别与填充设置的对应关系
        /// \return 返回true表示添加成功，否则添加失败
        virtual bool SetCategoryAndHatchSettingMap(const std::map<gcmp::UniIdentity, OwnerPtr<gcmp::IHatchSettings>>& categoryAndHatchSettingMap) = 0;

        /// \brief 获取类别与填充设置的对应关系
        /// \return 返回类别与填充设置的对应关系
        virtual const std::map<gcmp::UniIdentity, OwnerPtr<gcmp::IHatchSettings>>& GetCategoryAndHatchSettingMap() const = 0;

        /// \brief 获取类别与填充设置的对应关系
        /// \return 返回类别与填充设置的对应关系
        virtual std::map<gcmp::UniIdentity, OwnerPtr<gcmp::IHatchSettings>>& GetCategoryAndHatchSettingMap() = 0;

        /// \brief 设置PDF导出参数
        ///
        /// \param pdfExportParams pdf导出参数
        /// \return 返回true表示设置成功，否则设置失败
        virtual bool SetPDFExportParams(const OwnerPtr<gcmp::IPDFExportParams>& pdfExportParams) = 0;

        /// \brief 获取PDF导出参数
        /// \return 返回PDF设置的参数
        virtual const OwnerPtr<gcmp::IPDFExportParams>& GetPDFExportParams() const = 0;

#pragma endregion Hatch
        /// \brief 克隆一份导出设置对象
        /// \return 返回克隆的导出设置对象
        virtual gcmp::OwnerPtr<IDrawingExportSettings> Clone() const = 0;
    };
}
